package com.atguigu.gulimall.product.feign;

import com.atguigu.gulimall.common.to.SkuFullReductionOthersTo;
import com.atguigu.gulimall.common.to.SpuBoundsTo;
import com.atguigu.gulimall.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    /**
     * 远程调用保存优惠券信息
     * 1.@RequestBody 会将这个对象转化为json
     * 2.找到 gulimall-coupon 服务， 给/coupon/spubounds/save 发送请求
     * 将上一步转的json 放在请求体位置，并发送请求
     * 3. 对方服务收到请求，请求体里面有json数据
     *   @RequestBody SpuBoundsEntity spuBounds 将请求体的json 转为 SpuBoundsEntity；
     *   只要json数据模型是兼容的，双方服务无需使用同一个to
     * @param spuBoundsTo
     * @return
     */
    @PostMapping("/coupon/spubounds/save")
    public R save(@RequestBody SpuBoundsTo spuBoundsTo);


    @PostMapping("/coupon/skufullreduction/saveSkuInfo")
    public R saveSkuInfo(@RequestBody SkuFullReductionOthersTo reductionOthersTo);
}
